using System;
using System.Net;

namespace iPhOwa.Exchange.WebDav.Methods
{
	/// <summary>
	/// Implements the webdav MOVE method
	/// </summary>
	internal sealed class Move : Method
	{
		private readonly Uri destination;

		public Move(Uri path, Uri destination, OwaSession session) : base(path, session)
		{
			this.destination = destination;
		}

		/// <summary>
		/// The name of the method
		/// </summary>
		public override string Name
		{
			get { return "MOVE"; }
		}

		/// <summary>
		/// Build the command XML.
		/// </summary>
		protected override string BuildCommand()
		{
			return string.Empty;
		}

		/// <summary>
		/// Add method specific headers to request.
		/// </summary>
		protected override void AddHeaders(HttpWebRequest request)
		{
			request.Headers.Add("Destination", destination.ToString());
		}

		public void Run()
		{
			Execute();
		}
	}
}